package com.wuba.rxjavademo.tzx.create;

import com.wuba.rxjavademo.tzx.common.Base;

import java.util.Arrays;
import java.util.Collections;

import rx.Observable;
import rx.Subscriber;

/**
 * Created by tanzhenxing
 * Date: 2016/6/24.
 * Description:
 * from操作符可以转换Futrue,Iterable和数组,产生的 Observable会发射数组的每一项数据。
 */
public class RxFrom extends Base {
    public static void main(String[] args) {
        RxFrom from = new RxFrom();
        from.run();
    }

    @Override
    public void run() {
        Integer[] items = {0, 1, 2, 3, 4};
        Observable<Integer>[] observables = new Observable[]{Observable.just(1), Observable.just(2)};
        Observable.from(observables)
                .subscribe(new Subscriber<Observable<Integer>>() {
                    @Override
                    public void onCompleted() {

                    }

                    @Override
                    public void onError(Throwable e) {

                    }

                    @Override
                    public void onNext(Observable<Integer> integerObservable) {

                    }
                });
    }
}
